package com.service.Impl;

import com.dao.QuestionDao;
import com.mypg.Question;
import com.mypg.TQuestion;
import com.service.QuestionService;

import java.util.List;

public class QuestionServiceImpl implements QuestionService {

    private QuestionDao questionDao;

    public QuestionServiceImpl(){}
    public QuestionServiceImpl(QuestionDao questionDao) {
        this.questionDao = questionDao;
    }

    @Override
    public List<Question> selectAllQuestion() {
        return questionDao.selectAllQuestion();
    }

    @Override
    public Question selectQuestionByQuestion_id(int question_id) {
        return questionDao.selectQuestionByQuestion_id(question_id);
    }

    @Override
    public List<Question> selectQuestionFor_question_table_jsp(String question_class, String question_chapter,String question_ori, int start_row, int page_nums) {
        return questionDao.selectQuestionFor_question_table_jsp(question_class,question_chapter,question_ori,start_row,page_nums);
    }

    @Override
    public int selectQuestion_count_For_question_table_jsp(String question_class,String question_chapter,String question_ori) {
        return questionDao.selectQuestion_count_For_question_table_jsp(question_class,question_chapter,question_ori);
    }

    @Override
    public int selectQuestion_count() {
        return questionDao.selectQuestion_count();
    }

    @Override
    public List<Question> selectAllQuestionByChapter(String question_class,String question_chapter,String rand_flag,int rand_num,String other_class) {
        return questionDao.selectAllQuestionByChapter(question_class,question_chapter,rand_flag,rand_num,other_class);
    }

    @Override
    public int selectCountByChapter(String question_class, String question_chapter, String rand_flag, int rand_num, String other_class) {
        return questionDao.selectCountByChapter(question_class,question_chapter,rand_flag,rand_num,other_class);
    }

    @Override
    public List<Question> selectQuestionForReal_test(String question_class, String question_chapter,int question_num, int rand_num) {
        return questionDao.selectQuestionForReal_test(question_class,question_chapter,question_num,rand_num);
    }

    @Override
    public String[] selectQuestion_chapter(String question_class) {
        return questionDao.selectQuestion_chapter(question_class);
    }

    @Override
    public List<TQuestion> selectAllTQuestion() {
        return questionDao.selectAllTQuestion();
    }

    @Override
    public void insertQuestion(Question question) {
        questionDao.insertQuestion(question);
    }

    @Override
    public void deleteQuestionByQuestion_id(int question_id) {
        questionDao.deleteQuestionByQuestion_id(question_id);
    }

    @Override
    public void updateQuestionByQuestion_id(Question question) {
        questionDao.updateQuestionByQuestion_id(question);
    }

    @Override
    public void updateQuestion_imgByQuestion_id(String question_img, int question_id) {
        questionDao.updateQuestion_imgByQuestion_id(question_img,question_id);
    }

    public QuestionDao getQuestionDao() {
        return questionDao;
    }

    public void setQuestionDao(QuestionDao questionDao) {
        this.questionDao = questionDao;
    }
}
